﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TaskParallelLibrary
{
    class Program
    {
        static void Main(string[] args)
        {
            var t1 = new Task<int>(() =>
            {
                Console.WriteLine("Task 1");
                return 1;
            }
                                         );
            var t2 = t1.ContinueWith(t =>
            {
                Console.WriteLine("Task 2");
                var j = t.Result;
                return j + 1;
            }
                                        );
            t1.Start();

            Console.WriteLine("Results of T2 {0}", t2.Result);
            Console.ReadLine();
        }
    }
}
